import {BaseService, Result, Service} from "csap-typescript-vue2/lib";
import {ApidocModel, ApidocResultModel, ApidocSearchModel, PushSuccess} from "@/api/model/ApidocModel";
import {Request} from "csap-typescript-vue2/lib/model/Request";
import {AxiosPromise} from "axios";

@Service()
export class ApiDocService extends BaseService<ApidocModel, ApidocSearchModel, ApidocResultModel, number> {
    /**
     * 刷新文档
     * @param pathId
     */
    flushDoc(pathId: Request<Array<number>>): AxiosPromise<Result<boolean>> {
        return this.getHttpRequest().execute(pathId);
    };

    /**
     * 发布文档
     * @param pathId
     */
    publishDoc(data: Request<number>): AxiosPromise<Result<string>> {
        return this.getHttpRequest().execute(data);
    };

    /**
     * 是否发布成功
     * @param pathId
     */
    publishSuccess(id: Request<string>): AxiosPromise<Result<PushSuccess>> {
        return this.getHttpRequest().execute(id);
    };
}
